<script setup>
import {Clock, DataAnalysis, MapLocation, Upload} from '@element-plus/icons-vue'
import {useRouter} from "vue-router";
const router = useRouter()

function MenuSelect(idx){
  if (idx === "1") {
    router.replace({ path: "/user/map" }).catch((err) => {});
  }
  else if (idx === "2") {
    router.replace({ path: "/user/imageUpload" }).catch((err) => {});
  }
  else if (idx === "3") {
    router.replace({ path: "/user/imageUploadRecord" }).catch((err) => {});
  }
  else if (idx === "4") {
    router.replace({ path: "/user/dataAnalyze" }).catch((err) => {});
  }
}

</script>

<template>
  <el-menu @select="MenuSelect">
    <el-menu-item index="1">
      <template #title>
        <el-icon><MapLocation /></el-icon>种植区域管理
      </template>
    </el-menu-item>
    <el-menu-item index="2">
      <template #title>
        <el-icon><Upload /></el-icon>病害图像检测
      </template>
    </el-menu-item>
    <el-menu-item index="3">
      <template #title>
        <el-icon><Clock /></el-icon>上传检测记录
      </template>
    </el-menu-item>
    <el-menu-item index="4">
      <template #title>
        <el-icon><DataAnalysis /></el-icon>数据分析
      </template>
    </el-menu-item>
  </el-menu>
</template>

<style scoped>

</style>